﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using Zhaoxi.CSharpDemo.CSharp5;

namespace Zhaoxi.CSharpDemo
{
    public class CSharp5Info
    {
        /// <summary>
        /// C# 5.0 版 
        ///  C# 版本 5.0 随 Visual Studio 2012 一起发布，是该语言有针对性的一个版本。 对此版本中所做的几乎所有工作都归入另一个突破性语言概念
        /// </summary>
        public static async void Show()
        {
            //async await 相关内容 
            {
                UserInfo userInfo = new UserInfo();
                userInfo.Show();
                await userInfo.ShowAsync();
            }
            //调用方信息特性
            {
                new CSharp5Info().DoProcessing();
                new CSharp5Info().DoProcessingNew();
            }
        }

        public void DoProcessing()
        {
            TraceMessage("Something happened. DoProcessing");
        }

        public void DoProcessingNew()
        {
            TraceMessage("Something happened. DoProcessingNew");
        }

        public void TraceMessage(string message,
                [CallerMemberName] string memberName = "",
                [CallerFilePath] string sourceFilePath = "",
                [CallerLineNumber] int sourceLineNumber = 0)
        {
            Console.WriteLine("message: " + message);
            Console.WriteLine("member name: " + memberName);
            Console.WriteLine("source file path: " + sourceFilePath);
            Console.WriteLine("source line number: " + sourceLineNumber);

            //调用本方法，是哪个类中是哪个方法中的的第几行代码来调用本方法；
        }
    }
}
